/*=========================================================================

Program:   Virtual Surgery
Language:  C++
Date:      2009-9-1
Version:   0.1
Mail:		   nelfylee@gmail.com

Copyright (c) 2009 Nelfy Lee. All rights reserved.

=========================================================================*/
#ifndef _CONTROL_PANEL_DOCK_H_
#define _CONTROL_PANEL_DOCK_H_

#include <QDockWidget>
#include <QModelIndex>

#include "ControlPanelHome.h"

#include <QLineEdit>
#include <QComboBox>
#include <QScrollArea>
#include <QLabel>

class Source;
class PipelineModel;
class ControlPanelBase;
enum  PanelType;


class ControlPanelDock : public QDockWidget
{
	Q_OBJECT
public:
	ControlPanelDock(QWidget *parent);
	~ControlPanelDock();

	void setDisplayModel(DisplayModel *dm);
	void setPipeline(PipelineModel *pipeline);

public slots:
	ControlPanelBase* slotShowPanel(PanelType pt);
	ControlPanelBase*	slotShowHome();
	void slotSourceSelected(const QModelIndex&);
	void slotSourcePreRemove(const QModelIndex&);

	void slotProgressStart(QString str) { emit emitProgressStart(str);}
	void slotProgressUpdate(int i) { emit emitProgressUpdate(i); }
	void slotProgressDone() { emit emitProgressDone();}
	
signals:
	void emitProgressStart(QString);
	void emitProgressUpdate(int);
	void emitProgressDone();

private:
	ControlPanelBase* createPanel(PanelType);
	Source* getCurrentSource();
	ControlPanelBase* findPanel(PanelType pt);

private:
	QScrollArea *m_scrollArea;
	QComboBox *m_comboxPanels;
	QLabel *m_sourceName;
	DisplayModel *m_displayModel;
	PipelineModel *m_pipelineModel;
	Source *m_currentSource;
	ControlPanelHome *m_panelHome;
	QModelIndex m_isource;

	QList<ControlPanelBase*> m_panels;
};



#endif


